{% extends "base_generic.html" %}
{% block content %}
<div class="container">
    <h2>我的借阅</h2>
    {% if borrowed_books %}
        {% for bookinst in borrowed_books %}
            <div class="card">
                <strong>{{ bookinst.book.title }}</strong>
                <div>到期：{{ bookinst.due_back|date:'Y-m-d H:i' }}</div>
                <div>借阅时间：{{ bookinst.id|slice:'-12:'|date:'H:i' }}</div>
                <form method="post" action="{% url 'return-book' bookinst.id %}" style="display:inline;">
                  {% csrf_token %}
                  <button type="submit" class="btn btn-danger">归还</button>
                </form>
            </div>
        {% endfor %}
    {% else %}
        <div class="card">暂无借阅记录。</div>
    {% endif %}
</div>
{% endblock %}
